package com.tan.steamship.service.impl;

import cn.hutool.core.collection.CollectionUtil;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.tan.steamship.domain.CarouselPo;
import com.tan.steamship.exception.ExceptionEnum;
import com.tan.steamship.exception.XmException;
import com.tan.steamship.mapper.CarouselMapper;
import com.tan.steamship.service.CarouselService;
import org.springframework.stereotype.Service;

import java.util.List;

/**
* @author 85726
* @description 针对表【carousel】的数据库操作Service实现
* @createDate 2024-12-10 21:04:08
*/
@Service
public class CarouselServiceImpl extends ServiceImpl<CarouselMapper, CarouselPo>
    implements CarouselService{

    @Override
    public List<CarouselPo> getCarouselList() {
        List<CarouselPo> carouselPos = this.list();
        try {
            if (CollectionUtil.isEmpty(carouselPos)) {
                throw new XmException(ExceptionEnum.GET_CAROUSEL_NOT_FOUND);
            }
        } catch (Exception e) {
            e.printStackTrace();
            throw new XmException(ExceptionEnum.GET_CAROUSEL_ERROR);
        }
        return carouselPos;
    }
}




